﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Tong;
using Tong.TongJS_Prompt;
using Tong.Fy;
public partial class aspnet_admin_bock_FAQonLine_CX_FAQonLine_Show : System.Web.UI.Page
{    
    /// <summary>
    /// 数据操作通用类 实例 TextData
    /// </summary> 
    public TongUse TextData = new TongUse();

    /// <summary>
    /// 系统安装绝对路径
    /// </summary>
    public string Abs_Path = TongUse.SysPath;
    /// <summary>
    /// 用户存放数据的临时表
    /// </summary>
    DataTable MyDt = new DataTable();

    /// <summary>
    /// JS提示工能
    /// </summary>
    JsPrompt jspro = new JsPrompt();

    FenYe FY = new FenYe();
    protected void Page_Load(object sender, EventArgs e)
    {

        if (!IsPostBack)
        {
            BindData();
        }
    
    }

    /// <summary>
    /// 提问的搜索功能
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Button1_Click(object sender, EventArgs e)
    {
        GridView1.DataSource = FY.Fy("select * from [CX_FAQonLine] where Cx_FAQonLine_Question like '%" + Cx_FAQonLine_Question.Text.Trim() + "%' order by Cx_FAQonLine_id desc", 300);
        GridView1.DataBind();
        Div.InnerHtml = FY.GetHTML;
    }
    
    //看看是不是要删除数据
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {

        if (e.Row.RowType == DataControlRowType.DataRow)
        {

            LinkButton l = (LinkButton)e.Row.FindControl("LinkButton3");

            l.Attributes.Add("onclick", "javascript:return " +

            "confirm('您确定要删除 " +

            DataBinder.Eval(e.Row.DataItem, "Cx_FAQonLine_Question") + "吗?')");

        }
    }

    protected void BindData()
    {

        GridView1.DataSource = FY.Fy("select * from [CX_FAQonLine]", 30);
        GridView1.DataBind();
        Div.InnerHtml = FY.GetHTML;

    }


    /// <summary>
    /// 删除事件
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void delcc(object sender, EventArgs e)
    {

        string RedirID = ((LinkButton)sender).CommandArgument.ToString();
        if (RedirID != "")
        {
            try
            {
                TextData.SqlDataSave("delete [CX_FAQonLine] where Cx_FAQonLine_id = " + RedirID);
                tt.Text = "";
                tt.Text = "删除 信息成功";
                BindData();
            }
            catch
            {
                tt.Text = "";
                tt.Text = "删除  时出现错误　操作没有完成 ";
            }
        }

    }



    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        string RedirID = ((LinkButton)sender).CommandArgument.ToString();
        if (RedirID != "")
        {
            Response.Redirect("CX_FAQonLine_Edit.aspx?id=" + RedirID);
        }
    }
}
